Attribute VB_Name = "Module1"
Function Replace_symbols(ByVal txt As String) As String
    St$ = ":~!@/\#$%^&*=|`"""
    For i% = 1 To Len(St$)
        txt = Replace(txt, Mid(St$, i, 1), " ")
    Next
    Replace_symbols = txt
End Function
Function StrUtils_UCaseFirstChar(Optional strText As String = "") As String

Dim i As Long
Dim strChar As String
strText = " " & strText

For i = 2 To Len(strText)
   strChar = Mid(strText, i - 1, 1)

    Select Case Asc(strChar)

        Case 0 To 64, 91 To 96, 123 To 191

           Mid(strText, i, 1) = UCase(Mid(strText, i, 1))

        Case Else

           Mid(strText, i, 1) = LCase(Mid(strText, i, 1))
    End Select
Next i

StrUtils_UCaseFirstChar = strText

End Function
Function Revers(ByVal fullName As String) As String
    Dim nome As String
    Dim cognome As String
    Dim i As Integer
    If fullName <> " " And fullName <> "" Then
        i = InStr(2, fullName, " ")
        nome = Left(fullName, i - 1)
        cognome = Right(fullName, Len(fullName) - i)
        fullName = cognome & " " & nome
        Revers = fullName
    Else
        Revers = fullName
    End If
End Function
Sub RenameWorksheets()
Attribute RenameWorksheets.VB_ProcData.VB_Invoke_Func = " \n14"
    Dim i As Integer
    Dim w As Worksheet
    Dim str As String
    Dim str1 As String
    str1 = Application.ActiveSheet.Range("A13").Value
    i = InStr(1, str1, "ognome")
    If i <> 0 Then
        str = Mid(str1, 15)
    Else
        str = str1
    End If
    
    str = Replace_symbols(str)
    str = Trim(str)
    str = StrConv(str, vbProperCase)
    'str = StrUtils_UCaseFirstChar(str)
    str = Trim(str)
    
    str = Revers(str)
    With Application.FileDialog(msoFileDialogSaveAs)
        .InitialFileName = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & str
        .Title = str1
        .Show
    End With
    
    '  Application.Dialogs(xlDialogSaveAs).Show
        
    '  If str <> "" Then
    '      ActiveWorkbook.SaveAs (CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & Replace_symbols(str) & ".xsl")
    '  End If
      
    '  MsgBox CreateObject("WScript.Shell").SpecialFolders("Desktop")
    '   myInput = InputBox("Please type a number:")
    '   Application.ActiveSheet.Range("a5").Value = myInput
End Sub

